package com.cby.user.threadLocal;


import com.cby.user.entity.CbyUser;

public class UserThreadLocal {
    private UserThreadLocal(){}
    // 作用：线程变量隔离(线程安全的一个解决方案)
    private static final ThreadLocal<CbyUser> LOCAL = new ThreadLocal<>();
    // 放user
    public static void put(CbyUser user){
        LOCAL.set(user);
    }
    // 取user
    public static void get(CbyUser user){
        LOCAL.get();
    }
    // 移除user
    public static void remove(){
        LOCAL.remove();
    }
}
